<?php
/************************************************************************/
/*                       DinCMS: A fresh new CMS    					*/
/*                       File:  secure.class.php                        */
/* =====================================================================*/
/*                                                                      */
/* Copyright (c) 2008 by DinCMS Crew	                                */
/* http://dincms.org/                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License.       */
/*                                                                      */
/************************************************************************/

/* 
	Extra comments:
	-	Open the session in this class?
	-	Add extra safety by logging every pageload.
	-	Add extra safety by ip block option.
*/

class Secure {
	
	// Create the constructor to secure $_GET and $_POST
	function __construct() { 
		while (list($key,$value) = each($_GET)) {
			// Secure $_GET
		   $_GET[$key] = htmlentities(strip_tags(stripslashes($value))); 
		}
		while (list($key,$value) = each($_POST)) {
			// Secure $_POST
		   $_POST[$key] = htmlentities(strip_tags(stripslashes($value)));
		}
	}
	
	function logip {
		   $logip = "INSERT INTO ".$prefix."_logs_pageload (page, ip) VALUES ('".$page."', '".$_SERVER['REMOTE_ADDR']."')";
		   $sql->query($query);	
	}
}
?>

